/**mockApi说明：
 * method默认值是post
 * isMock默认值是false，即默认不拦截
 * code默认值是'200'
 * data: 可以是对象
 *       也可以是方法，通过参数返回不同的数据
 */
import {
  host,
  successCode,
} from '@/apis/client/paymentClient'
// 不需要提示为mock获取的数据的api
const notNeedMessageTip = [];

const mockApiData = {
  '/getCounterPaymentData': {
    method: 'post',
    isMock: true,
    data: {
      'data|10': [{
        claimno: 'C' + parseInt(Math.random() * 999999999),
        reportcaseno: 'R' + parseInt(Math.random() * 999999999),
        policyno: 'p' + parseInt(Math.random() * 999999999),
        endorseno: 'E' + parseInt(Math.random() * 999999999),
        summaryno: 'H' + parseInt(Math.random() * 999999999),
        datatype: '@cword(5,10)',
        customername: '@cname',
        handledamount: (Math.random() * 50000).toFixed(2),
        taxesamount: (Math.random() * 50000).toFixed(2),
        redtaxesamount: (Math.random() * 50000).toFixed(2),
        redinvoicetaxesamount: (Math.random() * 50000).toFixed(2),
        accountamount: (Math.random() * 50000).toFixed(2),
        amount: (Math.random() * 50000).toFixed(2),
        baseleftamount: (Math.random() * 50000).toFixed(2),
        'currencycode|+1': ['人民币', '美元', '港元'],
        'basecurrencycode|+1': ['人民币', '美元', '港元'],
        settlementno: 'A' + parseInt(Math.random() * 999999999),
        'returnno|+1': 1,
        businessattr: '@cword(5,10)',
        banks: '@cword(5,10)' + '银行',
        bankname: '@cword(5,10)' + '银行',
        description: '@cword(5,10)',
        'subcompany|+1': ['9010100', '8010100', '7010100', '6010100'],
        agentcode: '@cword(5,10)',
        opdate: '@date',
        classescode: '@cword(5,10)',
        custaccountno: '@cword(5,10)',
        customercode: 'SHH' + parseInt(Math.random() * 50000),
        fatherno: parseInt(Math.random() * 50000000),
        departmentcode: 'DP' + parseInt(Math.random() * 50000),
        usedamount: (Math.random() * 50000).toFixed(2),
        'handledbaseamount|+1': ['人民币', '美元', '港元'],
        baseusedamount: (Math.random() * 50000).toFixed(2),
        'baseamount+1': ['人民币', '美元', '港元'],
        payableno: 'PA' + parseInt(Math.random() * 50000),
        payableseq: 'PA' + parseInt(Math.random() * 50000),
        risktype: '@cword(5,10)',
        unitcode: parseInt(Math.random() * 50000),
        serialno: parseInt(Math.random() * 50000),
        custseq: parseInt(Math.random() * 50000),
        paymentmethod: '@cword(5,10)',
        ifpublic: '@cword(5,10)',
        checkcode: '@cword(5,10)',
        checkstatus: '@cword(5,10)',
        checkdate: '@date',
        checkcontent: '@cword(5,10)',
        endorsementrequestno: 'P' + parseInt(Math.random() * 50000),
        exstatus: '@cword(5,10)',
        exceptioncause: '@cword(5,10)',
        remark: '@cword(5,10)',
        gdunitcode: parseInt(Math.random() * 50000),
        gdunitname: '@cword(5,10)',

        //  "paymenttime": "@date",
        //  "amount": (Math.random() * 5000).toFixed(2),
        //  "in_currency|+1": drp_currency_values,
        //  "paymentmode|+1": ['1', '2']
      }, ],
    },
  },
  '/getProactivePaymentData': {
    method: 'post',
    isMock: true,
    data: {
      'data|10': [{
        claimno: 'C' + parseInt(Math.random() * 999999999),
        reportcaseno: 'R' + parseInt(Math.random() * 999999999),
        policyno: 'p' + parseInt(Math.random() * 999999999),
        endorseno: 'E' + parseInt(Math.random() * 999999999),
        summaryno: 'H' + parseInt(Math.random() * 999999999),
        datatype: '@cword(5,10)',
        customername: '@cname',
        handledamount: (Math.random() * 50000).toFixed(2),
        taxesamount: (Math.random() * 50000).toFixed(2),
        redtaxesamount: (Math.random() * 50000).toFixed(2),
        redinvoicetaxesamount: (Math.random() * 50000).toFixed(2),
        accountamount: (Math.random() * 50000).toFixed(2),
        amount: (Math.random() * 50000).toFixed(2),
        baseleftamount: (Math.random() * 50000).toFixed(2),
        currencycode: '@cword(5,10)',
        basecurrencycode: '@cword(2)',
        settlementno: 'A' + parseInt(Math.random() * 999999999),
        returnno: Math.random() * 50000,
        businessattr: '@cword(5,10)',
        banks: '@cword(5,10)',
        bankname: '@cword(5,10)',
        description: '@cword(5,10)',
        subcompany: Math.random() * 50000,
        agentcode: '@cword(5,10)',
        opdate: '@cdate()',
        classescode: '@cword(5,10)',
        custaccountno: '@cword(5,10)',
        customercode: Math.random() * 50000,
        fatherno: Math.random() * 50000,
        departmentcode: Math.random() * 50000,
        usedamount: (Math.random() * 50000).toFixed(2),
        handledbaseamount: '@cword(5,10)',
        baseusedamount: (Math.random() * 50000).toFixed(2),
        baseamount: '@cword(5,10)',
        payableno: Math.random() * 50000,
        payableseq: Math.random() * 50000,
        risktype: '@cword(5,10)',
        unitcode: Math.random() * 50000,
        serialno: Math.random() * 50000,
        custseq: Math.random() * 50000,
        paymentmethod: '@cword(5,10)',
        ifpublic: '@cword(5,10)',
        checkcode: '@cword(5,10)',
        checkstatus: '@cword(5,10)',
        checkdate: '@cdate()',
        checkcontent: '@cword(5,10)',
        endorsementrequestno: 'P' + Math.random() * 50000,
        exstatus: '@cword(5,10)',
        exceptioncause: '@cword(5,10)',
        remark: '@cword(5,10)',
        gdunitcode: Math.random() * 50000,
        gdunitname: '@cword(5,10)',

        //  "paymenttime": "@date",
        //  "amount": (Math.random() * 5000).toFixed(2),
        //  "in_currency|+1": drp_currency_values,
        //  "paymentmode|+1": ['1', '2']
      }, ],
    }
  },
  '/imageAudit': {
    method: 'post',
    isMock: true,
    data: true,
  },
  '/getClasses': {
    method: 'post',
    isMock: true,
    data: {
      'data|10': [{
        classescode: '0101' + parseInt(Math.random() * 9999),
        classescodename: '@cword(5,10)' + '险',
      }, ],
    },
  },
  '/getProxyPoint': {
    method: 'post',
    isMock: true,
    data: {
      'data|10': [{
        classescode: 'SH' + parseInt(Math.random() * 9999),
        classescodename1: '@cword(5,10)',
      }, ],
    }
  },
  '/getTransactorcode': {
    method: 'post',
    isMock: true,
    data: {
      'data|2': [{
        'code|+1': [
          'SHH' + parseInt(Math.random() * 9999),
          'SHH' + parseInt(Math.random() * 9999),
        ],
        name: '@cname',
      }, ],
    },
  },
  '/getDepartment': {
    method: 'post',
    isMock: true,
    data: {
      'data|10': [{
        departmentcode: 'SHH' + parseInt(Math.random() * 9999),
        departmentname: '@cword(5,10)' + '部门',
      }, ],
    },
  },
  '/submitData': {
    method: 'post',
    isMock: true,
    data: true,
  },
  '/getProvince': {
    method: 'post',
    isMock: true,
    data: {
      'data': [{
          value: '01',
          label: '江苏'
        },
        {
          value: '02',
          label: '浙江'
        },
      ],
    },
  },
  '/getCity': {
    method: 'post',
    isMock: true,
    data: function (param) {
      const params = param;
      let data = null
      if (params == "01") {
        data = {
          'data': [{
              value: '011',
              label: '苏州'
            },
            {
              value: '012',
              label: '南京'
            },
          ],
        }
      } else if (params == "02") {
        data = {
          'data': [{
              value: '021',
              label: '杭州'
            },
            {
              value: '022',
              label: '宁波'
            },
          ],
        }
      }
      return data
    },
  },
  '/getArea': {
    method: 'post',
    isMock: true,
    data: function (params) {
      let data = null
      if (params == "011") {
        data = {
          'data': [{
              value: '0111',
              label: '虎丘区'
            },
            {
              value: '0112',
              label: '相城区'
            },
          ],
        }
      } else if (params == "012") {
        data = {
          'data': [{
              value: '0121',
              label: '玄武区'
            },
            {
              value: '0122',
              label: '建邺区'
            },
          ],
        }
      } else if (params == "021") {
        data = {
          'data': [{
              value: '0211',
              label: '临平区'
            },
            {
              value: '0212',
              label: '余杭区'
            },
          ],
        }
      } else if (params == "022") {
        data = {
          'data': [{
              value: '0221',
              label: '江北区'
            },
            {
              value: '0222',
              label: '镇海区'
            },
          ],
        }
      }
      return data
    },
  },
}

export {
  host,
  successCode,
  notNeedMessageTip,
  mockApiData,
};